﻿<phone:PhoneApplicationPage 
    x:Class="Qplus.UI.EntryPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    Style="{StaticResource TranstionPageStyle}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    xmlns:my="clr-namespace:Qplus"
    xmlns:UI="clr-namespace:Qplus.UI" Loaded="PhoneApplicationPage_Loaded" BackKeyPress="PhoneApplicationPage_BackKeyPress">

    
    
    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Background="#D0000000">
        <!--枢轴控件-->
        <controls:Pivot Background="Transparent">
            <controls:Pivot.Title >
                <TextBlock></TextBlock>
            </controls:Pivot.Title>
            
            <!--枢轴项一-->
            <controls:PivotItem Margin="0">
                <controls:PivotItem.Header>
                    <TextBlock Text="好友" FontSize="30" Width="140" HorizontalAlignment="Center"/>
                </controls:PivotItem.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="80"/>
                    </Grid.ColumnDefinitions>
                    <ListBox Visibility="Visible">
                        <toolkit:WrapPanel x:Name="friendWP"></toolkit:WrapPanel>
                    </ListBox>
                    <ItemsControl  x:Name="friendItemsControl" Visibility="Collapsed" Background="#B28BB2F1" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Padding="3">
                                    <toolkit:WrapPanel ScrollViewer.VerticalScrollBarVisibility="Auto">
                                        <UI:FriendControl DataContext="Binding fList"/>
                                    </toolkit:WrapPanel>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ListBox x:Name="flist" Visibility="Collapsed">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel></toolkit:WrapPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <UI:FriendControl CtrlType="{Binding type}" UserID="{Binding userID}" UserName="{Binding userName}" UserLevel="{Binding userLevel}"
                                                  HeadType="{Binding headType}" HeadValue="{Binding headValue}"/>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
            
            <!--枢轴项二-->
            <controls:PivotItem Margin="0">
                <controls:PivotItem.Header>
                    <TextBlock Text="聊天室" FontSize="30" Width="140" HorizontalAlignment="Center"/>
                </controls:PivotItem.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="400"/>
                        <ColumnDefinition Width="80"/>
                    </Grid.ColumnDefinitions>
                    <ScrollViewer Visibility="Collapsed" VerticalScrollBarVisibility="Auto" Grid.Column="0">
                        <toolkit:WrapPanel Name="chatroomWP">
                            
                        </toolkit:WrapPanel>
                    </ScrollViewer>
                    <ItemsControl  x:Name="roomItemsControl"
                                   Visibility="Collapsed"
                                   Background="#B28BB2F1" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Padding="3">
                                    <toolkit:WrapPanel ScrollViewer.VerticalScrollBarVisibility="Auto">
                                        <UI:ChatRoomControl DataContext="Binding rList"/>
                                    </toolkit:WrapPanel>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ListBox x:Name="rlist" Visibility="Visible">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel></toolkit:WrapPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <UI:ChatRoomControl CtrlType="{Binding type}" RoomID="{Binding roomID}" RoomName="{Binding roomName}"
                                                    RoomLevel="{Binding roomLevel}" UserCount="{Binding userCount}"
                                                    UpperLimit="{Binding upperLimit}"
                                                    RoomHeadType="{Binding roomHeadType}" RoomHeadValue="{Binding roomHeadValue}"
                                                    RoomHeat="{Binding roomHeat}" RoomPoint="{Binding roomPoint}"/>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <!--                    <ListBox Grid.Column="0">
                        <Grid Name="chatroomGrid" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="200"/>
                                <ColumnDefinition Width="200"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="200"/>
                            </Grid.RowDefinitions>
                            <Grid Grid.Row="0" Grid.Column="0">
                                <Border Name="createChatroomBtnExBorder" Width="160" Height="160" Background="#DCFFFF00" Margin="20" Grid.Row="0" Grid.Column="0" />
                                <my:ButtonEx x:Name="createChatroomBtnEx" Width="200" Height="200" Content="创建聊天室" VerticalContentAlignment="Bottom" Grid.Row="0" Grid.Column="0"
                                             BorderBrush="Transparent" BorderThickness="10" PressedBorderBrush="LightSkyBlue" Click="createChatroomBtnEx_Click">
                                    <my:ButtonEx.Background>
                                        <ImageBrush ImageSource="/Qplus;component/Pic/icon_create_chatroom_item.png" Stretch="None" />
                                    </my:ButtonEx.Background>
                                    <my:ButtonEx.PressedBackground>
                                        <ImageBrush ImageSource="/Qplus;component/Pic/icon_create_chatroom_item.png" Stretch="None" />
                                    </my:ButtonEx.PressedBackground>
                                </my:ButtonEx>
                            </Grid>
                        </Grid>
                        <toolkit:WrapPanel x:Name="chatroomWP"></toolkit:WrapPanel>
                    </ListBox>
-->
                    <my:ButtonEx x:Name="refreshBtn" Width="80" Height="80" BorderThickness="0"
                                 Grid.Column="1" VerticalAlignment="Top" Click="refreshBtn_Click">
                        <my:ButtonEx.Background>
                            <ImageBrush ImageSource="/Qplus;component/Pic/refreshnormal.png" Stretch="None" />
                        </my:ButtonEx.Background>
                        <my:ButtonEx.PressedBackground>
                            <ImageBrush ImageSource="/Qplus;component/Pic/refreshfocus.png" Stretch="None" />
                        </my:ButtonEx.PressedBackground>
                    </my:ButtonEx>
                </Grid>
            </controls:PivotItem>
            
            <!--枢轴项三-->
            <controls:PivotItem Margin="0">
                <controls:PivotItem.Header>
                    <TextBlock Text="陌生人" FontSize="30" Width="140" HorizontalAlignment="Center"/>
                </controls:PivotItem.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="400"/>
                        <ColumnDefinition Width="80"/>
                    </Grid.ColumnDefinitions>
                    <ListBox>
                        <toolkit:WrapPanel x:Name="strangerWP">
                            
                        </toolkit:WrapPanel>
                    </ListBox>
                    <ListBox x:Name="slist" Grid.Column="0" Visibility="Collapsed">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel></toolkit:WrapPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <UI:FriendControl CtrlType="{Binding type}" UserID="{Binding userID}" UserName="{Binding userName}" UserLevel="{Binding userLevel}"
                                                  HeadType="{Binding headType}" HeadValue="{Binding headValue}"/>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
        <my:ButtonEx x:Name="personalInfoConfig" Width="80" Height="80" BorderThickness="0"
                     HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,80" Click="personalInfoConfig_Click">
            <my:ButtonEx.Background>
                <ImageBrush ImageSource="/Qplus;component/Pic/btn_personal_setting.png" Stretch="None" />
            </my:ButtonEx.Background>
            <my:ButtonEx.PressedBackground>
                <ImageBrush ImageSource="/Qplus;component/Pic/btn_personal_setting_pressed.png" Stretch="None" />
            </my:ButtonEx.PressedBackground>
        </my:ButtonEx>
        <my:ButtonEx x:Name="colseBtn" Width="80" Height="80" BorderThickness="0"
                     HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="colseBtn_Click">
            <my:ButtonEx.Background>
                <ImageBrush ImageSource="/Qplus;component/Pic/btn_exit.png" />
            </my:ButtonEx.Background>
            <my:ButtonEx.PressedBackground>
                <ImageBrush ImageSource="/Qplus;component/Pic/btn_exit_pressed.png" />
            </my:ButtonEx.PressedBackground>
        </my:ButtonEx>
        <Button Content="TestBtn" Visibility="Collapsed" Height="72" HorizontalAlignment="Right" Margin="10,10,100,0" Name="button1" VerticalAlignment="Bottom" Width="160" Click="testBtn_Click" />
    </Grid>

    <!--
                        <Grid>
                        <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="200"/>
                                <ColumnDefinition Width="200"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="200"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid Grid.Row="0" Grid.Column="0">
                                <Border Name="FriendBtnExBorder" Background="#EB00E3FF" Margin="20" />
                                <Border Name="friendNickNameBackground" Height="40" Background="#D0808080" VerticalAlignment="Bottom" Margin="20"/>
                                <my:ButtonEx x:Name="searchFriendBtnEx" Content="好友搜索" VerticalContentAlignment="Bottom"
                                             PressedBorderBrush="LightBlue" BorderBrush="Transparent" BorderThickness="10"
                                             Click="searchFriendBtnEx_Click">
                                    <my:ButtonEx.Background>
                                        <ImageBrush ImageSource="/Qplus;component/Pic/icon_search_friends_item.png" Stretch="None"/>
                                    </my:ButtonEx.Background>
                                    <my:ButtonEx.PressedBackground>
                                        <ImageBrush ImageSource="/Qplus;component/Pic/icon_search_friends_item.png" Stretch="None"/>
                                    </my:ButtonEx.PressedBackground>
                                </my:ButtonEx>
                            </Grid>-->
    <!--
    <ListBox Visibility="Collapsed" BorderBrush="White" BorderThickness="0" Height="500" VerticalAlignment="Bottom" x:Name="lstData">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate >
                                <StackPanel>
                                    <Button x:Name="btnData" >
                                        <StackPanel Orientation="Vertical">
                                            <Image Source="ApplicationIcon.jpg" Width="100" Height="100" />
                                            <TextBlock Text="{Binding Name}" Width="100" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                                <my:FriendControl></my:FriendControl>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
    -->
    <!--
    <Grid Name="chatroomGrid" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="200"/>
                                <ColumnDefinition Width="200"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="200"/>
                            </Grid.RowDefinitions>
                            <Grid Grid.Row="0" Grid.Column="0">
                                <Border Name="createChatroomBtnExBorder" Width="160" Height="160" Background="#DCFFFF00" Margin="20" Grid.Row="0" Grid.Column="0" />
                                <my:ButtonEx x:Name="createChatroomBtnEx" Width="200" Height="200" Content="创建聊天室" VerticalContentAlignment="Bottom" Grid.Row="0" Grid.Column="0"
                                             BorderBrush="Transparent" BorderThickness="10" PressedBorderBrush="LightSkyBlue" Click="createChatroomBtnEx_Click">
                                    <my:ButtonEx.Background>
                                        <ImageBrush ImageSource="/Qplus;component/Pic/icon_create_chatroom_item.png" Stretch="None" />
                                    </my:ButtonEx.Background>
                                    <my:ButtonEx.PressedBackground>
                                        <ImageBrush ImageSource="/Qplus;component/Pic/icon_create_chatroom_item.png" Stretch="None" />
                                    </my:ButtonEx.PressedBackground>
                                </my:ButtonEx>
                            </Grid>
                        </Grid>
    -->
    <!--演示 ApplicationBar 用法的示例代码-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="按钮 1"/>
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="按钮 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="菜单项 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="菜单项 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->
    
</phone:PhoneApplicationPage>